public class Java21 {
    public static void main(String[] args) {
        //实现计算“1+3+5+7+···99”的值
        int sum = 0;
        for (int i = 1; i < 100; i++) {
            if (i % 2 != 0)
                sum += i;
        }
        System.out.println("1+3+5+7+···99的值为：" + sum);

        //冒泡排序实现对组数{25,24,12,76,101,96,28}
        int[] g = new int[]{25, 24, 12, 76, 101, 96, 28};
        int min = g[0], max = g[0];
        for (int i = 0; i < g.length; i++) {
            if (g[i] < min) min = g[i];
            if (g[i] > max) max = g[i];
        }
        System.out.println("数组最小值是：" + min);
        System.out.println("数组最大值是：" + max);
        for (int i = 1; i < g.length; i++) {
            for (int j = 0; j < g.length - i; j++) {
                if (g[j] > g[j + 1]) {
                    int temp = g[j];
                    g[j] = g[j + 1];
                    g[j + 1] = temp;
                }
            }

        }
        for (int i = 0; i < g.length; i++) {
            System.out.print(g[i] +",");
        }
    }
}
